package cn.trigram.example.designpattern.memento.black;

//发起人
public class BlankOriginator {

  private String state;

  public String getState() {

    return state;
  }

  public void setState(String state) {

    this.state = state;
  }

  public MementoIF createMemento() {

    return new Memento(state);
  }

  public void recoverMemento(MementoIF memento) {

    this.setState(((Memento) memento).getState());
  }

  //以内部类实现备忘录角色
  private class Memento implements MementoIF {

    private String state;

    private Memento(String state) {

      this.state = state;
    }

    private String getState() {

      return state;
    }

  }

}
